package com.airconditioning.util;

public class Result {

    /**
     * 代码执行状态
     * 1    正常
     * 0   【正常的】警告
     * -1  【中断的】错误
     */
    private Integer sysCode = -1;

    /**
     * 业务处理状态
     * 1    正常
     * 0   【正常的】警告
     * -1  【中断的】错误
     */
    private Integer bizCode;

    /**
     * 代码执行错误
     */
    private String sysError;
    /**
     * 代码执行警告
     */
    private String sysRemind;

    /**
     * 业务执行错误
     */
    private String bizError;
    /**
     * 业务执行警告
     */
    private String bizRemind;

    /**
     * 正常业务的数据
     */
    private Object data;

    public Integer getSysCode() {
        return sysCode;
    }

    public void setSysCode(Integer sysCode) {
        this.sysCode = sysCode;
    }

    public Integer getBizCode() {
        return bizCode;
    }

    public void setBizCode(Integer bizCode) {
        this.bizCode = bizCode;
    }

    public String getSysError() {
        return sysError;
    }

    public Result setSysError(String sysError) {
        this.sysCode = -1;
        this.sysError = sysError;
        return this;
    }

    public String getSysRemind() {
        return sysRemind;
    }

    public Result setSysRemind(String sysRemind) {
        this.sysCode = 0;
        this.sysRemind = sysRemind;
        return this;
    }

    public String getBizError() {
        return bizError;
    }

    public Result setBizError(String bizError) {
        this.sysCode = 1;
        this.bizCode = -1;
        this.bizError = bizError;
        return this;
    }

    public String getBizRemind() {
        return bizRemind;
    }

    public Result setBizRemind(String bizRemind) {
        this.sysCode = 1;
        this.bizCode = 0;
        this.bizRemind = bizRemind;
        return this;
    }

    public Object getData() {
        return data;
    }

    public Result setData(Object data) {
        this.sysCode = 1;
        this.bizCode = 1;
        this.data = data;
        return this;
    }

    public Result setOk() {
        this.sysCode = 1;
        this.bizCode = 1;
        this.data = true;
        return this;
    }


    public Result setRemind(String[] remind) {
        this.sysCode = 1;
        this.bizCode = Integer.valueOf(remind[0]);
        this.bizRemind = remind[1];
        return this;
    }


    public Result setError(String[] error) {
        this.sysCode = 1;
        this.bizCode = Integer.valueOf(error[0]);
        this.bizRemind = error[1];
        return this;
    }

}
